CREATE TABLE [dbo].[TRAUXI_GEST]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[CO_CNTA_EMPR] [dbo].[TD_VC_020_CNTA] NOT NULL,
[TI_AUXI_EMPR] [dbo].[TD_VC_001] NOT NULL,
[CO_AUXI_EMPR] [dbo].[TD_VC_020] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TRAUXI_GE__NU_AN__6E8B6712] DEFAULT (datepart(year,getdate())),
[CO_CNTA_DEST] [dbo].[TD_VC_020_CNTA] NOT NULL,
[CO_CNTA_CONT] [dbo].[TD_VC_020_CNTA] NOT NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TRAUXI_GE__FE_US__725BF7F6] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TRAUXI_GE__FE_US__73501C2F] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [CK__TRAUXI_GE__CO_CN__6D9742D9] CHECK (([CO_CNTA_EMPR]>='0' AND [CO_CNTA_EMPR]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [CK__TRAUXI_GE__CO_CN__7073AF84] CHECK (([CO_CNTA_DEST]>='0' AND [CO_CNTA_DEST]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [CK__TRAUXI_GE__CO_CN__7167D3BD] CHECK (([CO_CNTA_CONT]>='0' AND [CO_CNTA_CONT]<='99999999999999999999'))
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [CK__TRAUXI_GE__NU_AN__6F7F8B4B] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [XPKTRAUXI_GEST] PRIMARY KEY CLUSTERED  ([CO_EMPR], [CO_CNTA_EMPR], [TI_AUXI_EMPR], [CO_AUXI_EMPR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TRAUXI_GEST] ADD CONSTRAINT [TMPLAN_ANNO_A_TRAUXI_GEST] FOREIGN KEY ([CO_EMPR], [CO_CNTA_EMPR]) REFERENCES [dbo].[TMPLAN_ANNO] ([CO_EMPR], [CO_CNTA_EMPR])
GO
